package com.hruiworks.campusgroup.controller;

import com.hruiworks.campusgroup.common.BaseResponse;
import com.hruiworks.campusgroup.common.PageVO;
import com.hruiworks.campusgroup.enums.SuccessCode;
import com.hruiworks.campusgroup.manager.entity.ActivityData;
import com.hruiworks.campusgroup.pojo.entity.Activity;
import com.hruiworks.campusgroup.pojo.entity.ActivityGrade;
import com.hruiworks.campusgroup.pojo.entity.ActivityMessage;
import com.hruiworks.campusgroup.pojo.entity.User;
import com.hruiworks.campusgroup.pojo.query.ActivityPageQuery;
import com.hruiworks.campusgroup.pojo.request.ActivityCreateRequest;
import com.hruiworks.campusgroup.service.ActivityGradeService;
import com.hruiworks.campusgroup.service.ActivityMessageService;
import com.hruiworks.campusgroup.service.ActivityService;
import com.hruiworks.campusgroup.utils.AuthorityUtils;
import com.hruiworks.campusgroup.utils.ResultUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 活动信息相关Controller
 *
 * @author jiushui
 */
@RestController
@RequestMapping("/api/message/activity")
public class ActivityMessageController {

    @Resource
    private ActivityMessageService activityMessageService;



    /**
     * 分页获取活动上新消息
     * @param size
     * @param current
     * @param httpServletRequest
     * @return
     */
    @GetMapping("/page")
    public BaseResponse<PageVO<ActivityMessage>> listPageActivityMessage(@RequestParam("size") Long size,
                                                                      @RequestParam("current") Long current,
                                                                      HttpServletRequest httpServletRequest) {
        User user = AuthorityUtils.currentUser(httpServletRequest);
        PageVO<ActivityMessage> activityMessagePageVO = activityMessageService.listPageActivityMessage(current, size, user);
        return ResultUtils.success(activityMessagePageVO, SuccessCode.COMMON_SUCCESS);
    }




}
